package com.java.utils;

import com.java.domain.ShopCart;

import java.util.ArrayList;
import java.util.List;

/**
 * @version 2020.3.4
 * @User 悠恋
 * @Data 2022/11/27
 * @Time 9:37
 */
public class ShopCartUtils {
    // 取出当前用户的所有的商品
    public static List<ShopCart> getShopCartList(List<ShopCart> cartList, String uname) {
        // 将当前登录的用户的所有信息添加到集合中
        List<ShopCart> shopCartList = new ArrayList<>();
        for (ShopCart cart : cartList) {
            if (uname.equals(cart.getUname())) {
                //System.out.println(cart);
                shopCartList.add(cart);
            }
        }
        return shopCartList;
    }
}
